package com.hzhr.iot.meterplan.sdk.constant;

import com.hzhr.iot.core.constant.HttpExceptionCategory;
import com.hzhr.iot.core.constant.ServiceErrors;
import com.hzhr.iot.core.constant.ServiceExceptionCategory;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;

public enum Meterplan_ErrorsEnum implements ServiceErrors {

    //region test
    //region get
    TESTSERVICE_GET_201(201, "查询实施档案", "实施档案不存在", ServiceExceptionCategory.BUSINESS_EXCEPTION, HttpExceptionCategory.CLIENT_EXCEPTION, HttpStatus.FORBIDDEN),
    //endregion
    //endregion

    //region test
    //region post
    METERPLAN_METERGASUSERSERVICE_POST_202(202, "查询抄表计划状态", "只有非执行中的抄表计划才能加入或移除用户", ServiceExceptionCategory.BUSINESS_EXCEPTION, HttpExceptionCategory.CLIENT_EXCEPTION, HttpStatus.FORBIDDEN),
    //endregion
    //endregion


    //region test
    //region post
    METERPLAN_PUBLISHSERVICE_POST_201(201, "查询抄表计划状态", "抄表计划不存在", ServiceExceptionCategory.BUSINESS_EXCEPTION, HttpExceptionCategory.CLIENT_EXCEPTION, HttpStatus.FORBIDDEN),
    METERPLAN_PUBLISHSERVICE_POST_202(201, "验证抄表计划下的抄表册", "抄表册已经完成录入，无法发布数据", ServiceExceptionCategory.BUSINESS_EXCEPTION, HttpExceptionCategory.CLIENT_EXCEPTION, HttpStatus.FORBIDDEN),
    //endregion
    //endregion


    //region test
    //region get MeterPlanMeterGasUserService
    METERPLAN_METERGASUSERSERVICE_POST_201(201, "查询抄表计划", "抄表计划不存在", ServiceExceptionCategory.BUSINESS_EXCEPTION, HttpExceptionCategory.CLIENT_EXCEPTION, HttpStatus.FORBIDDEN);
    //endregion
    //endregion


    private Integer code;
    private String messaeg;
    private String business;
    private ServiceExceptionCategory serviceExceptionCategory;
    private HttpExceptionCategory httpExceptionCategory;
    private HttpStatus httpStatus;
    Meterplan_ErrorsEnum(Integer code, String business, String message, ServiceExceptionCategory serviceExceptionCategory, HttpExceptionCategory httpExceptionCategory, HttpStatus httpStatus) {
        this.code = code;
        this.business = business;
        this.messaeg = message;
        this.serviceExceptionCategory = serviceExceptionCategory;
        this.httpExceptionCategory = httpExceptionCategory;
        this.httpStatus = httpStatus;
    }






    @Override
    public Integer getCode() {
        return code;
    }
    @Override
    public String getBusiness() {
        return business;
    }
    @Override
    public String getMessage() {
        return messaeg;
    }
    @Override
    public ServiceExceptionCategory getServiceExceptionCategory() {
        return serviceExceptionCategory;
    }
    @Override
    public HttpExceptionCategory getHttpExceptionCategory() {
        return httpExceptionCategory;
    }
    @Override
    public HttpStatus getHttpStatus() {
        return httpStatus;
    }
    @Override
    public void setMessage(String message) {
        this.messaeg = message;
    }

    public static Meterplan_ErrorsEnum getEnumByName(String name) {
        if (StringUtils.isEmpty(name)) return null;
        for (Meterplan_ErrorsEnum errorsEnum : Meterplan_ErrorsEnum.values()) {
            if (errorsEnum.name().equals(name)) {
                return errorsEnum;
            }
        }
        return null;
    }
}

